package com.aspose.cells;

import java.util.Iterator;

public class VbaModuleCollection extends CollectionBase {
   short b;
   VbaProject c;

   VbaModuleCollection(VbaProject p) {
      this.c = p;
      this.b = -1;
   }

   void a(VbaModule var1) {
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
   }

   public int add(Worksheet sheet) {
      String var2 = sheet.getCodeName();

      for(int var3 = 0; var3 < this.getCount(); ++var3) {
         VbaModule var4 = this.get(var3);
         if (com.aspose.cells.b.a.zv.a(var4.a, var2, true) == 0) {
            return var3;
         }
      }

      VbaModule var5 = new VbaModule(this.c, 1, var2);
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var5);
      return this.a.size() - 1;
   }

   public int add(int type, String name) {
      VbaModule var3 = new VbaModule(this.c, type, name);
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var3);
      return this.a.size() - 1;
   }

   public VbaModule get(int index) {
      return (VbaModule)this.a.get(index);
   }

   public VbaModule get(String name) {
      for(int var2 = 0; var2 < this.getCount(); ++var2) {
         VbaModule var3 = this.get(var2);
         if (com.aspose.cells.b.a.zv.a(var3.a, name, true) == 0) {
            return var3;
         }
      }

      return null;
   }

   boolean a() {
      Iterator var1 = this.iterator();

      VbaModule var2;
      do {
         if (!var1.hasNext()) {
            return false;
         }

         var2 = (VbaModule)var1.next();
      } while(var2.m == null);

      return true;
   }
}
